// ============================================================================
//
// Graph framework by Aurelien Moreau aurelien.moreau@gmail.com
// Modified by Pierre CHATEL chatelp@gmail.com
// Distributed under LGPL
// Copyright (C) Aurelien Moreau, 2008, 2009. All rights reserved
//
// ============================================================================

package com.thalesgroup.graphFramework.core.impl;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

import com.thalesgroup.graphFramework.core.Graph;
import com.thalesgroup.graphFramework.core.GraphObject;


public class GraphObjectImpl<V, E> implements GraphObject<V, E> {

	final protected GraphImpl<V, E> graph;

	final private Map<String, Object> features;

	final protected int index;

	public GraphObjectImpl(final GraphImpl<V, E> graph, int index) {
		this.graph = graph;
		this.index = index;
		features = Collections.synchronizedMap(new HashMap<String, Object>());
	}

	public Graph<V, E> getGraph() {
		return graph;
	}

	public int getIndex() {
		return index;
	}

	public Object getUserFeature(final String feature) {
		return features.get(feature);
	}

	public Object setUserFeature(final String feature, final Object data) {
		return features.put(feature, data);
	}

}
